<template>
	<view class="recharge">
		<u-popup v-model="isRecharge" mode="bottom" border-radius="15" @open="open" @close="close">
			<view class="content">
				<view class="content-title">该内容为会员专享，开通后解锁播放</view>
				<RechargeTemplate :memberList="memberList" @recharge-success="onRechargeSuccess"></RechargeTemplate>
				<view class="footer-title">
					温馨提示：
				</view>
				<view class="row">
					1 . VIP会员属于虚拟商品，一经购买不可退换；
				</view>
				<view class="row">
					2 . 未满18周岁的用户，须在监护人主导并同意下进行相关付款操作；
				</view>
				<view class="row">
					3 . 如出现付费相关问题，可在“我的”—“联系我们”，添加客服联系方式进行咨询；
				</view>
				<view class="row">
					4 . VIP会员仅在本小程序内使用。
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import RechargeTemplate from '@/components/recharge-template/index.vue'
	import {
		getConfigRecharges
	} from '@/request/api.js'
	import {
		handleMember
	} from '@/common/Newapp.js'
	export default {
		props: {
			isRecharge: {
				type: Boolean,
				default: false
			},
		},
		components: {
			RechargeTemplate
		},
		data() {
			return {
				memberList: []
			}
		},
		methods: {
			async open() {
				const result = await getConfigRecharges({
					system_type:uni.getStorageInfoSync('osName') == "ios" ? 2:1
					// system_type: "2",
				})
				this.memberList = handleMember(result.data)
			},

			close() {
				this.$emit('update:isRecharge', false)
			},

			onRechargeSuccess(payload) {
				// payload may contain purchase info or selected member
				// emit to parent that recharge succeeded, then close popup
				this.$emit('recharge-success', payload)
				this.$emit('update:isRecharge', false)
			}
		}
	}
</script>

<style lang="less" scoped>
	.recharge {
		width: 100%;

		.content {
			padding: 40rpx 40rpx 150rpx 40rpx;
			.content-title {
				color: rgb(213, 170, 87);
				text-align: center;
				font-size: 28rpx;
			}
			.footer-title{
				height: 44rpx;
				font-weight: 600;
				font-size: 32rpx;
				line-height: 44rpx;
				color: #424242;
				margin: 30rpx 0 30rpx 0;
			}
			.row{
				font-size: 28rpx;
				line-height: 46rpx;
				color: #5E5E5E;
			}
		}

	}
</style>